 <form name="form1">
 <input type="text" name="nip">
 <input type="button" value="cek" onclick="return cek();">
 </form>
 
 <script type="text/javascript">
 function cek(){
 var x = document.forms['form1']['nip'].value;
 alert(x);
 }
 
 </script>